package com.log.config;

import com.log.conn.LogAspect;
import org.springframework.beans.BeansException;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * @ClassName BaseConfig
 * @Author xiezhuocai
 * @Description TODO
 * @Date 2022/5/9 21:57
 */
@Configuration
public class BaseConfig implements ApplicationContextAware {

    private ApplicationContext context;

    @Bean
    @ConditionalOnMissingBean(LogAspect.class)
    public LogAspect logAspect(){
        LogAspect logAspect = new LogAspect();
        return logAspect;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        context = applicationContext;
    }


}
